using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace QuanLyKhachSan
{
    public class HoaDonDAO
    {
        // Them mot doi tuong Hoa don
        public static bool Insert(HoaDonDTO hoaDondto)
        {
            int kq = 0;
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "INSERT INTO HoaDon(ngayLapHoaDon,tongTien,maKhachHang) VALUES ('" + hoaDondto.NgayLapHoaDon.ToString() + "'," + hoaDondto.TongTien + "," + hoaDondto.MaKhachHang + ")";
            kq = con.ExecuteNonQuery1(sql);
            if (kq > 0)
            {
                return true;
            }
            return false;
        }

        // Lay danh sach Hoa don
        public static DataTable LayDanhSachHoaDon()
        {
            DataTable dt = new DataTable();
            return dt;
        }

        // Lay danh sach Hoa don theo tung khach hang
        public static DataTable LayDanhSachHoaDon(int maKhachHang)
        {
            DataTable dt = new DataTable();
            return dt;
        }
        //Lay ma hoa don vua them
        public static DataTable LayMaHoaDonMoiThem()
        {
            DataTable dt = new DataTable();
            DataAccessHelper con = new SqlDataAccessHelper();
            string sql = "SELECT * FROM HoaDon WHERE maHoaDon=" + "(SELECT MAX(maHoaDon) FROM HoaDon)";
            dt = con.ExecuteQuery(sql);
            return dt;
        }
    }
}
